#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2019/5/23 16:35
# @Author  : khz_df
# @Site    : 
# @File    : download_captcha.py
# @Software: ce9nt


import os
import urllib.request


def main():
    file_path = r'N:\_TMP\captcha\battle_net'
    img_url = 'https://www.battlenet.com.cn/login/captcha.jpg?1558600422269'

    file_path = r'N:\_TMP\captcha\4399_result_test'
    img_url = 'http://ptlogin.4399.com/ptlogin/captcha.do?captchaId=captchaReqb57f01673ba94435726&xx=1'

    for i in range(10):
        filename = r'%s\%d.png' % (file_path, i)
        urllib.request.urlretrieve(img_url, filename=filename)


if __name__ == "__main__":
    print("------------------    Enter __main__    ------------------")

    print(u"[Current work directory is : ]\t" + os.getcwd())
    print(u"[Current process ID is : ]\t" + str(os.getpid()))
    print("\n")
    main()

    print("------------------    Leave __main__    ------------------")
